﻿namespace com.nm.Hook
{
    public interface IHook
    {
        int HookType { get; }

        /// <summary>
        /// 优先级，值越大越优先
        /// </summary>
        int Priority { get; }

        /// <summary>
        /// 执行Hook
        /// </summary>
        /// <param name="isEnd">是否终止</param>
        /// <param name="pArgs"></param>
        /// <returns>执行成功返回0，其他为错误代码</returns>
        int Execute(out bool isEnd, params object[] pArgs);
    }

    public abstract class BaseHook : IHook
    {
        public abstract int HookType
        {
            get;
        }

        public abstract int Priority
        {
            get;
        }

        public virtual int Execute(out bool isEnd, params object[] pArgs)
        {
            isEnd = false;
            return 0;
        }
    }
}